<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"
    />
</head>

<body>

    <script type="text/javascript">

        function baseClass() {
            this.showMsg = function () {
                console.log("baseClass::showMsg\n");
            }

            this.baseShowMsg = function () {
                console.log("baseClass::baseShowMsg\n");
            }
        }
        baseClass.showMsg = function () {
            console.log("baseClass::showMsg static\n");
        }

        function extendClass() {
            this.showMsg = function () {
                console.log("extendClass::showMsg\n");
            }
        }
        extendClass.showMsg = function () {
            console.log("extendClass::showMsg static\n")
        }

        extendClass.prototype = new baseClass();
        var instance = new extendClass();

        instance.showMsg(); //显示extendClass::showMsg
        instance.baseShowMsg(); //显示baseClass::baseShowMsg
        instance.showMsg(); //显示extendClass::showMsg

        baseClass.showMsg.call(instance);//显示baseClass::showMsg static

        var baseinstance = new baseClass();
        baseinstance.showMsg.call(instance);//显示baseClass::showMsg
    </script>

</body>

</html>